function [U, S, V, Z, obj] = actSSsubproblem(A, B, lambda, data, row, col, tol, Z)

% Z = zeros(size(A, 2), size(B, 2));
S = svd(Z);

spa = sparse(row, col, data);
spa(size(A,1), size(B,1)) = 0;

maxIter = 500;
obj = zeros(maxIter, 1);
for i = 1:maxIter
    temp = partXY((A*Z)', B', row, col, length(row));
    temp = data - temp';
    spa = setSval(spa, temp, length(col));
    
    obj(i) = sum(temp.^2)/2 + lambda*sum(S(:));
    
    Z = Z + A'*spa*B;
    
    [U, S, V] = proximalOperator( Z, lambda);
    Z = U*S*V';
    
    % fprintf('iter %d, obj %d \n', i, obj(i));
    if(i > 1 && abs(obj(i) - obj(i - 1)) < tol)
        break;
    end
end
obj = obj(1:i);

end